#ifndef DROP_H
#define	DROP_H

#include "Dot.h"
#include "Wave.h"

struct RefractionWaves {
    RefractionWaves(Wave set_first, Wave set_second, Wave set_third) : first(set_first), second(set_second), third(set_third) {};
    Wave first;
    Wave second;
    Wave third;
};

class Drop {
public:
    Drop(Dot set_position, unsigned set_radius) : position(set_position), radius(set_radius) {};
    Dot getPosition() const { return position; }
    unsigned getRadius() const { return radius; }
    
    RefractionWaves refraction(Wave &wave);
    bool hasCrossing(Wave wave);
    
    void selftest(void);
    
private:
    Dot position;
    unsigned radius;
    
    int crossingEquation(double k, double a, double b, double c, bool return_max);
    double calculateTangent(Wave wave, bool is_input);
};

#ifndef DROP_IMPUT_FACTOR
#define DROP_IMPUT_FACTOR 0.361234
#endif

#ifndef DROP_OUTPUT_FACTOR
#define DROP_OUTPUT_FACTOR 0.371293
#endif

#endif	/* DROP_H */
